import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TransactionsVO, TransactionsForm, TransactionsQuery } from '@/api/tearoom/transactions/types';

/**
 * 查询钱包充值交易流水列表
 * @param query
 * @returns {*}
 */

export const listTransactions = (query?: TransactionsQuery): AxiosPromise<TransactionsVO[]> => {
  return request({
    url: '/tearoom/transactions/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询钱包充值交易流水详细
 * @param id
 */
export const getTransactions = (id: string | number): AxiosPromise<TransactionsVO> => {
  return request({
    url: '/tearoom/transactions/' + id,
    method: 'get'
  });
};

/**
 * 新增钱包充值交易流水
 * @param data
 */
export const addTransactions = (data: TransactionsForm) => {
  return request({
    url: '/tearoom/transactions',
    method: 'post',
    data: data
  });
};

/**
 * 修改钱包充值交易流水
 * @param data
 */
export const updateTransactions = (data: TransactionsForm) => {
  return request({
    url: '/tearoom/transactions',
    method: 'put',
    data: data
  });
};

/**
 * 删除钱包充值交易流水
 * @param id
 */
export const delTransactions = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/transactions/' + id,
    method: 'delete'
  });
};
